package com.ruoyi.until;

import lombok.Data;

/**
 * @author: liufei
 * @Desc:
 * @create: 2024-11-07 09:38
 **/
@Data
public class R {

    private String msg;

    private Integer code;

    private Boolean flag;

    private Object data;

    public static R ok(){
        R r = new R();
        r.setCode(200);
        r.setFlag(true);
        r.setMsg("success");
        return r;
    }

    public static R ok(Object data){
        R r = new R();
        r.setCode(200);
        r.setFlag(true);
        r.setMsg("success");
        r.setData(data);
        return r;
    }

    public static R error(){
        R r = new R();
        r.setCode(500);
        r.setFlag(false);
        r.setMsg("error");
        return r;
    }

    public static R error(String msg){
        R r = new R();
        r.setCode(500);
        r.setFlag(false);
        r.setMsg(msg);
        return r;
    }

}
